package server;
// NetworkOutput.java
// Used by the server
// Holds an output stream and has a send() method
// Called by the UpdateThread thread
// It sends data to the client

import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.SocketException;

import client.ServerResponse;

class NetworkOutput
{
	private ObjectOutputStream out;

	// Create output stream
	public NetworkOutput(Socket s)
	{
		try
		{
			out = new ObjectOutputStream(s.getOutputStream());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

	// Call to send a ServerResponse to the client
	public void send(ServerResponse sr) throws SocketException
	{
		try
		{
			out.writeObject(sr);
		}
		// Thrown when client exits
		catch(SocketException e)
		{
			throw e;
		}
		catch(Exception e)
		{
			e.printStackTrace();

		}
	}
}